<?php

/**
 * Created by PhpStorm.
 * User: feng
 * Date: 2017/1/21
 * Time: 下午10:45
 */
class Staff extends CI_Controller
{
    /**
     * 任务列表
     */
    public function task()
    {
        Permission::gz();
        $data = array(
            'header_json' => $this->lyw_common_model->buildHeaderJson(),
        );
        $this->load->view('staff_task', $data);
    }

    public function proofread()
    {
        Permission::gz();
        $this->load->view('taskworker_proofead', $this->lyw_common_model->readProofread());
    }

    public function writeYunYinGTitle()
    {
        Permission::gz(1);
        $manager_id = isset($_POST['manager_id']) ? $_POST['manager_id'] : 0;
        $yungyin_title = isset($_POST['yunyingtitle']) ? $_POST['yunyingtitle'] : '';
        $this->load->model('Lyw_article_manager_model');
        $this->Lyw_article_manager_model->updateYungYinTitle($manager_id,$yungyin_title);
        exit(json_encode('success'));
    }

    public function writeReadNumber()
    {
        Permission::gz(1);
        $read_number = isset($_POST['readnumber']) ? $_POST['readnumber'] : 0;
        $text_number = isset($_POST['textnumber']) ? $_POST['textnumber'] : 0;
        $manager_id = isset($_POST['manager_id']) ? $_POST['manager_id'] : 0;
        $score = isset($_POST['score']) ? $_POST['score'] : 0;
        $translation_user_id = isset($_POST['translation_user_id']) ? $_POST['translation_user_id'] : 0;
        if (!$read_number || empty($text_number) || empty($manager_id) || empty($translation_user_id)) {
            exit(json_encode('Error:empty!'));
        }
        $this->load->model('Lyw_common_model');
        $this->Lyw_common_model->processFinish($manager_id, $read_number, $text_number, $score, $translation_user_id);
        exit(json_encode('success'));
    }
}